﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Image_Product.ascx.cs" Inherits="Bussiness.View.BackEnd.User_Control.Image_Product" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
       <ext:Store runat="server" ID="Store1">
            <Reader>
                <ext:JsonReader IDProperty="Name">
                    <Fields>
                        <ext:RecordField Name="Name" />
                        <ext:RecordField Name="Url" />      
                        <ext:RecordField Name="Size" Type="Int" />
                        <ext:RecordField Name="Lastmod" Type="Date" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store> 
    <ext:Window ID="mg_Image" runat="server" Icon="Group" Title="Danh mục hàng hóa"
    Width="400" Height="300" Hidden="true" Layout="FormLayout" LabelAlign="Left"  IDMode="Static" Cls="img-chooser-view">
    <Items>
        <ext:FileUploadField ID="pu_FileUpLoad" IDMode="Static" runat="server" FieldLabel="Chọn file ảnh" >
        <DirectEvents>
                            <FileSelected OnEvent="UpLoadFile"  /> 
                        </DirectEvents>
        </ext:FileUploadField>
         <ext:Panel 
            ID="ImagePanel" 
            runat="server" 
            Frame="false" 
            Width="360" 
            Height="220"
            AutoScroll="true"
            Layout="Fit">
            <Items>      
         <ext:DataView 
                    ID="ImageView" 
                    runat="server"
                    StoreID="Store1"
                    MultiSelect="true"
                    ItemSelector="div.thumb-wrap"                 
                    EmptyText="No images to display">
                    <Template ID="Template1" runat="server">
                        <Html>
							<tpl for=".">
								<div class="thumb-wrap" id="{Name}">
									<div class="thumb"><img src="{Url}" title="{Name}"></div>
									<span class="x-editable">{shortName}-{Name}</span>
								</div>
							</tpl>
							<div class="x-clear"></div>    
						</Html>
                    </Template>                         
                </ext:DataView>
    </Items>
    <Buttons>
        <ext:Button runat="server" Text="Xóa" ID="btXoa" Icon="Delete">
           <DirectEvents>
                        <Click OnEvent="deleteImage">
                            <ExtraParams>
                                <ext:Parameter Name="Values" Value="Ext.encode(#{ImageView}.getRowsValues())" Mode="Raw" />
                            </ExtraParams>
                            <Confirmation ConfirmRequest="true" Title="Cảnh Báo" Message="Bạn muốn xóa ảnh này không?" />
                        </Click>
                    </DirectEvents>
        </ext:Button>
        <ext:Button runat="server" Text="Đóng" ID="btClose" Icon="Cancel">
            <Listeners>
                <Click Fn="closeDataView" />
            </Listeners>
        </ext:Button>
    </Buttons>
    </ext:Panel>
    </Items>
    </ext:Window>
    
    <script type="text/javascript">


        function closeDataView() {
            Ext.getCmp('mg_Image').setVisible(false);
        }
    </script>